﻿rem see http://msdn.microsoft.com/en-us/library/aa213088(SQL.80).aspx how to use the script
@echo off

osql -S %1 -E -b -n -q "IF EXISTS(SELECT * FROM sysdatabases WHERE name = '%2') BEGIN DROP DATABASE %2 END"
osql -S %1 -E -b -n -q "CREATE DATABASE %2"

osql -S %1 -d %2 -E -b -i create scripts\db.sql -n

echo Finished building %2

@echo on 